//package cn.rongdao.jrkabao.ui.main.mainfragment.uicomponent;
//
//import android.content.Context;
//import android.support.annotation.Nullable;
//import android.support.v4.content.ContextCompat;
//import android.text.SpannableString;
//import android.text.Spanned;
//import android.text.style.AbsoluteSizeSpan;
//import android.text.style.ForegroundColorSpan;
//import android.util.AttributeSet;
//import android.view.View;
//import android.widget.ImageView;
//import android.widget.LinearLayout;
//import android.widget.TextView;
//
//import com.mifengkong.frtools.util.FRCollection;
//import com.mifengkong.frtools.util.FRImageLoad;
//import com.mifengkong.frtools.util.FRString;
//
//import cn.rongdao.jrkabao.R;
//import cn.rongdao.jrkabao.bean.cashadvance.CashAdvanceBean;
//import cn.rongdao.jrkabao.ui.cashadvance.CashAdvanceActivity;
//
///**
// * Created by jack on 2017/9/12
// */
//
//public class CashAdvanceHeaderUIComponent extends LinearLayout {
//    public CashAdvanceHeaderUIComponent(Context context) {
//        super(context);
//    }
//
//    public CashAdvanceHeaderUIComponent(Context context, @Nullable AttributeSet attrs) {
//        super(context, attrs);
//    }
//
//    public CashAdvanceHeaderUIComponent(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
//        super(context, attrs, defStyleAttr);
//    }
//
//    private LinearLayout llVip;
//    private TextView tvName;
//    private TextView tvContent;
//    private ImageView ivAvatar;
//    private TextView tvGoCash;
//
//    private LinearLayout llFinancing;
//    private View viewLineFinancing;
//    private TextView tvDescription;
//    private String institutionId;
//
//    @Override
//    protected void onFinishInflate() {
//        super.onFinishInflate();
//        llVip = (LinearLayout) findViewById(R.id.lcah_ll_vip);
//        tvName = (TextView) findViewById(R.id.lcah_tv_title);
//        tvContent = (TextView) findViewById(R.id.lcah_tv_content);
//        ivAvatar = (ImageView) findViewById(R.id.lcah_iv_avatar);
//        tvGoCash = (TextView) findViewById(R.id.lcah_tv_go_cash);
//
//        llFinancing = (LinearLayout) findViewById(R.id.lcah_ll_financing);
//        viewLineFinancing = findViewById(R.id.lcah_view_line_financing);
//        tvDescription = (TextView) findViewById(R.id.lcah_tv_description);
//
//        llVip.setOnClickListener(new OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                CashAdvanceActivity.start(getContext(), institutionId);
//            }
//        });
//    }
//
//    public void setVipContent(CashAdvanceBean.Vip data) {
//        llVip.setVisibility(View.VISIBLE);
//        institutionId = data.getInstitution_id();
//        tvName.setText(FRString.valueOf(data.getTitle()));
//        FRImageLoad.loadImage(data.getImg(), ivAvatar);
//        tvContent.setText(getSpannableContent(FRString.valueOf(data.getContent()), FRString.valueOf(data.getText())));
//        tvGoCash.setText(FRString.valueOf(data.getButton_text()));
//    }
//
//    public void setDescription(String description) {
//        llFinancing.setVisibility(View.VISIBLE);
//        tvDescription.setText(FRString.valueOf(description));
//    }
//
//    public void setViewFinancingLineVisible(boolean isVisible) {
//        viewLineFinancing.setVisibility(isVisible ? VISIBLE : GONE);
//    }
//
//    private SpannableString getSpannableContent(String title, String content) {
//        String str = FRCollection.appendAsString(title, content, "\n");
//        SpannableString ss = new SpannableString(str);
//        ss.setSpan(new AbsoluteSizeSpan(14, true), title.length(), str.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
//        ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.c999999)), title.length(), str.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
//        return ss;
//    }
//
//    public void setVipClickListener(OnClickListener onClickListener) {
//        llVip.setOnClickListener(onClickListener);
//    }
//}
